﻿using GalaSoft.MvvmLight;
using TfL;
using Tfl.ViewModel;

namespace Tfl.Tracker.WP7.ViewModel
{
    /// <summary>
    /// This class contains properties that the main View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm/getstarted
    /// </para>
    /// </summary>
    public class MainViewModel : ViewModelBase
    {
        public string ApplicationTitle
        {
            get
            {
                return "TrackerNet";
            }
        }

        public string PageName
        {
            get
            {
                return "Line Status";
            }
        }

        public string Welcome
        {
            get
            {
                return "Welcome to MVVM Light";
            }
        }

        public LineStatusViewModel LineStatusViewModel
        {
            get { return _lineStatusViewModel; }
            set
            {
                _lineStatusViewModel = value;
            }
        }

        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            if (IsInDesignMode)
            {
                LineStatusViewModel = new DesignTimeLineStatusViewModel();
            }
            else
            {
                LineStatusViewModel = new LineStatusViewModel(new TrackerNet("http://cloud.tfl.gov.uk/TrackerNet/", "http://webservices.lul.co.uk/").LineStatus);
            }
        }

        private LineStatusViewModel _lineStatusViewModel;

        ////public o.verride void Cleanup()
        ////{
        ////    // Clean up if needed

        ////    base.Cleanup();
        ////}
    }
}